package cn.com.elite;

import java.sql.Connection;
import java.sql.DriverManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.com.elite.util.Util;

public class DataBaseConnection{
	private static final Log log=LogFactory.getLog(DataBaseConnection.class);
	private String DBDRIVER="oracle.jdbc.driver.OracleDriver";
	private String DBURL="jdbc:oracle:thin:@192.168.1.134:1521:zhpt";
	private String DBUSER="limeng";
	private String DBPASSWORD="limeng";  
	private Connection conn=null; 
	
	public String getDBDRIVER() {
		return DBDRIVER;
	}
	public void setDBDRIVER(String dbdriver) {
		DBDRIVER = dbdriver;
	}
	public String getDBURL() {
		return DBURL;
	}
	public void setDBURL(String dburl) {
		DBURL = dburl;
	}
	public String getDBUSER() {
		return DBUSER;
	}
	public void setDBUSER(String dbuser) {
		DBUSER = dbuser;
	}
	public String getDBPASSWORD() {
		return DBPASSWORD;
	}
	public void setDBPASSWORD(String dbpassword) {
		DBPASSWORD = dbpassword;
	}
	public DataBaseConnection(){
		try{
			Class.forName(DBDRIVER);
			conn=DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD);		
		}catch(Exception e){
			log.error("DataBaseConnection错误:"+Util.getERRO(e)); 
		}
	}
	public Connection getConnection(){
		return this.conn;
	}
	public void close(){
		try{
			this.conn.close(); 
		}catch(Exception e){
			log.error("close错误:"+Util.getERRO(e)); 
		}
	}

}
